package com.hhit.zhgd.service

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.hhit.zhgd.domain.entity.Admin
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest
class AdminServiceTests {

    @Autowired
    private var adminService: AdminService?=null

    @Test
    fun getListTest() {
        val page = Page<Admin>(1, 10)
        val params = HashMap<String, Any>()
        val list = adminService?.getList(page, params)
        list?.records?.forEach {
            println(it)
        }
    }

    @Test
    fun getInfoTest() {
        val params = HashMap<String, Any>()
        params["id"] = 3
        val info = adminService?.getInfo(params)
        info?.let {
            println(it)
        } ?: run {
            println("null")
        }
    }

    @Test
    fun checkLoginTest() {
        val params = HashMap<String, Any>()
        params["username"] = "admin"
        params["password"] = "admin"
        val result = adminService?.checkLogin(params)
        result?.let {
            println(it)
        } ?: run {
            println("null")
        }
    }

    @Test
    fun getRoleAdminAllTest() {
        val roleAdminAll = adminService?.getRoleAdminAll(1)
        roleAdminAll?.forEach {
            println(it)
        }
    }
}